home *** CD-ROM | disk | FTP | other *** search
- // Abrowser.prg
- //
- // Returns TBrowse object fully configured to browse an array
-
- #include "Abrowser.ch"
-
- FUNCTION ABrowseNew()
-
- LOCAL oTbr := TBrowseNew()
-
- // We use cargo as a 2 element array:
- // The first is the index to array we are browsing
- // The second is a pointer to the array
- // Abrowser.ch contains two definitions that translate
- // :arrayIndex and :arrayReference into these elements
- // - just makes the code a bit more readable
-
- oTbr:cargo := Array(2)
-
- oTbr:arrayIndex := 1
- oTbr:goTopBlock := {|| oTbr:arrayIndex := 1 }
- oTbr:goBottomBlock := {|| oTbr:arrayIndex := Len(oTbr:arrayReference) }
-
- // Standard array skipper
- oTbr:skipBlock := {|nToSkip, nTemp| ;
- nTemp := oTbr:arrayIndex, ;
- oTbr:arrayIndex := ;
- iif(nToSkip > 0, ;
- Min(oTbr:arrayIndex + nToSkip, ;
- Len(oTbr:arrayReference)), ;
- Max(1, oTbr:arrayIndex + nToSkip)), ;
- oTbr:arrayIndex - nTemp ;
- }
-
- RETURN oTbr